﻿using System;
using System.Text;

class FloatBinaryRepresentation
{
    static void Main()
    {
        StringBuilder resultBuilder = new StringBuilder();
        float floatNumber = -27.25f;
        int number;
        unsafe
        {
            number = *((int*)&floatNumber); //this is the magic :D
        }

        for (byte i = 0; i < 32; i++)
        {
            resultBuilder.Insert(0, number >> i & 1);
        }

        string result = resultBuilder.ToString();
        //Result
        Console.WriteLine("Number: {0}\nSign: {1}\nExponent: {2}\nMantissa: {3}",
            floatNumber, result.Substring(0, 1), result.Substring(1, 8), result.Substring(9));
    }
}
